﻿var app = angular.module("myApp", ["ngRoute"]);

app.config(['$routeProvider', function ($routeProvider) {
    $routeProvider
    .when('/show', {
        templateUrl: 'tpls/show.html',
        controller: 'fstCtrl'
    })
    .when('/put/:id', {
        templateUrl: 'tpls/put.html',
        controller: 'scdCtrl'
    })
    .otherwise({
        redirectTo: '/show'
    });
}]);

app.controller('fstCtrl', ['$scope', function ($scope) {

}]);

app.controller('scdCtrl', ['$scope', '$routeParams', function ($scope, $routeParams) {
    $scope.ids = function () {
        var data = [];
        for (var i = 1; i <= 10; i++) {
            data.push(i);
        }
        return data;
    }
    console.log($scope.ids())
    $scope.id = $routeParams.id;
}]);